load("@workerd//:build/wd_cc_library.bzl", "wd_cc_library")
load("@workerd//:build/wd_rust_binary.bzl", "wd_rust_binary")

wd_rust_binary(
    name = "gen-compile-cache",
    cxx_bridge_src = "main.rs",
    test_size = "large",
    visibility = ["//visibility:public"],
    deps = [
        ":cxx-bridge",
        "@crates_vendor//:clap",
    ],
)

wd_cc_library(
    name = "cxx-bridge",
    srcs = [
        "cxx-bridge.c++",
    ],
    hdrs = [
        "cxx-bridge.h",
    ],
    linkstatic = select({
        "@platforms//os:windows": True,
        "//conditions:default": False,
    }),
    deps = [
        "//src/rust/cxx-integration",
        "//src/workerd/jsg",
        "//src/workerd/jsg:compile-cache",
        "@capnp-cpp//src/kj",
    ],
)
